package com.itheima.autoconfig;

import com.itheima.autoconfig.properties.*;
import com.itheima.autoconfig.template.AipFaceTemplate;
import com.itheima.autoconfig.template.HuanXinTemplate;
import com.itheima.autoconfig.template.OssTemplate;
import com.itheima.autoconfig.template.SmsTemplate;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

@EnableConfigurationProperties({
        SmsProperties.class,
        OssProperties.class,
        AipFaceProperties.class,
        HuanXinProperties.class,
        QuestionsProperties.class
})//使@ConfigurationProperties生效
public class TanhuaAutoConfiguration {

    @Bean//将对象存到容器中
    public SmsTemplate smsTemplate(SmsProperties properties) {
        return new SmsTemplate(properties);
    }
    @Bean
    public OssTemplate ossTemplate(OssProperties ossProperties){
        return new OssTemplate(ossProperties);
    }
    @Bean
    public AipFaceTemplate aipFaceTemplate(){
        return new AipFaceTemplate();
    }
    @Bean
    public HuanXinTemplate huanXinTemplate(HuanXinProperties huanXinProperties){
        return new HuanXinTemplate(huanXinProperties);
    }
}